monitoring HTTP Error Codes

monitoring HTTP Error Codes

am 18.10.2009 22:28:47 von Madan Thapa

--000e0cd2e302e80fa104763b79aa
Content-Type: text/plain; charset=ISO-8859-1

Hi,

Please advise on how can we monitor HTTP Error Codes on a web server and
then send an email alert upon errors.


The HTTP Error Codes we need alerts on are 404,406,500 and 501 errors


We do not want to monitor it for a particular site, but serverwide. So we
need to find some way to pull the details from apache error log (
/etc/httpd/logs/error_log )


Thanks

--000e0cd2e302e80fa104763b79aa
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,

Please advise on how can we monitor HTTP Error Codes on a web se=
rver and then send an email alert upon errors.


diumtext">
The HTTP Error Codes we need alerts on are 404,406
diumtext">,500 and 501 errors
<=
br>
We do not want to monitor it for a particular site, but serverwide.=
=A0 So we need to find some way to pull the details from apache error log (=
/etc/httpd/logs/error_log )



Thanks




--000e0cd2e302e80fa104763b79aa--

Re: monitoring HTTP Error Codes

am 18.10.2009 23:16:57 von Scott Haneda

Set your Error Document directive:
http://httpd.apache.org/docs/2.0/mod/core.html#errordocument

ErrorDocument 404 /place/mailer.php
ErrorDocument 406 /place/mailer.php
ErrorDocument 500 /place/mailer.php
ErrorDocument 501 /place/mailer.php

In mailer.php, or whatever scripting language you chose to use, you
will have code that sends an email. I would be careful, this can get
a little out of hand, and you will get a lot of emails.

I may be inclined to do something like this: (pseudo code)

no_mail_arr = array('google', 'bing', etc etc etc)
if (user_agent not in array)
$message = the headers + the page name + the url + the agent + referrer
mail(someone@example.com 'error on page $page', $message)
end if

In reality, I think it would be better to just set up a custom logging
directive, and log any http you desire, to a special log, with all the
data you need. Run that log through any good stats software, and you
will be much better off.

--
Scott * If you contact me off list replace talklists@ with scott@ *

On Oct 18, 2009, at 1:28 PM, MadTh wrote:

> Please advise on how can we monitor HTTP Error Codes on a web server
> and then send an email alert upon errors.
>
> The HTTP Error Codes we need alerts on are 404,406,500 and 501 errors
>
> We do not want to monitor it for a particular site, but serverwide.
> So we need to find some way to pull the details from apache error
> log ( /etc/httpd/logs/error_log


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: monitoring HTTP Error Codes

am 18.10.2009 23:24:31 von Madan Thapa

--001636d34bfe441a5704763c4123
Content-Type: text/plain; charset=ISO-8859-1

Thank you Scott, I knew about .htacess but was not sure that it is supported
over "server config" context in apache.






On Mon, Oct 19, 2009 at 2:46 AM, Scott Haneda wrote:

> Set your Error Document directive:
> http://httpd.apache.org/docs/2.0/mod/core.html#errordocument
>
> ErrorDocument 404 /place/mailer.php
> ErrorDocument 406 /place/mailer.php
> ErrorDocument 500 /place/mailer.php
> ErrorDocument 501 /place/mailer.php
>
> In mailer.php, or whatever scripting language you chose to use, you will
> have code that sends an email. I would be careful, this can get a little
> out of hand, and you will get a lot of emails.
>
> I may be inclined to do something like this: (pseudo code)
>
> no_mail_arr = array('google', 'bing', etc etc etc)
> if (user_agent not in array)
> $message = the headers + the page name + the url + the agent +
> referrer
> mail(someone@example.com 'error on page $page', $message)
> end if
>
> In reality, I think it would be better to just set up a custom logging
> directive, and log any http you desire, to a special log, with all the data
> you need. Run that log through any good stats software, and you will be much
> better off.
>
> --
> Scott * If you contact me off list replace talklists@ with scott@ *
>
>
> On Oct 18, 2009, at 1:28 PM, MadTh wrote:
>
> Please advise on how can we monitor HTTP Error Codes on a web server and
>> then send an email alert upon errors.
>>
>> The HTTP Error Codes we need alerts on are 404,406,500 and 501 errors
>>
>> We do not want to monitor it for a particular site, but serverwide. So we
>> need to find some way to pull the details from apache error log (
>> /etc/httpd/logs/error_log
>>
>
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

--001636d34bfe441a5704763c4123
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Thank you Scott, I knew about .htacess but was not sure that it is supporte=
d over "server config" context in apache.





=

On Mon, Oct 19, 2009 at 2:46 AM, Scott Haned=
a <talklists@n=
ewgeo.com
>
wrote:

204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Set your Error Do=
cument directive:

rget=3D"_blank">http://httpd.apache.org/docs/2.0/mod/core.ht ml#errordocumen=
t




ErrorDocument 404 /place/mailer.php

ErrorDocument 406 /place/mailer.php

ErrorDocument 500 /place/mailer.php

ErrorDocument 501 /place/mailer.php



In mailer.php, or whatever scripting language you chose to use, you will ha=
ve code that sends an email. =A0I would be careful, this can get a little o=
ut of hand, and you will get a lot of emails.



I may be inclined to do something like this: (pseudo code)



no_mail_arr =3D array('google', 'bing', etc etc etc)

if (user_agent not in array)

=A0 =A0 =A0 =A0$message =3D the headers + the page name + the url + the ag=
ent + referrer

=A0 =A0 =A0 =A0mail( k">someone@example.com 'error on page $page', $message)

end if



In reality, I think it would be better to just set up a custom logging dire=
ctive, and log any http you desire, to a special log, with all the data you=
need. Run that log through any good stats software, and you will be much b=
etter off.




--

Scott * If you contact me off list replace talklists@ with scott@ *
v>




On Oct 18, 2009, at 1:28 PM, MadTh wrote:



204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Please advise on how can we monitor HTTP Error Codes on a web server and th=
en send an email alert upon errors.



The HTTP Error Codes we need alerts on are 404,406,500 and 501 errors



We do not want to monitor it for a particular site, but serverwide. =A0So w=
e need to find some way to pull the details from apache error log ( /etc/ht=
tpd/logs/error_log






------------------------------------------------------------ ---------

The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL: lank">http://httpd.apache.org/userslist.html> for more info.

To unsubscribe, e-mail: g" target=3D"_blank">users-unsubscribe@httpd.apache.org

=A0" =A0 from the digest: httpd.apache.org" target=3D"_blank">users-digest-unsubscribe@httpd.apache.o=
rg


For additional commands, e-mail: org" target=3D"_blank">users-help@httpd.apache.org






--001636d34bfe441a5704763c4123--